import sys

from qfluentwidgets import PushButton

import ToolsWindow
import TreeWindow
import AdressWindow

from PyQt6.QtWidgets import QApplication, QPushButton

from 项目实例.WebWindow import WebWindow


def tree_window(a0: ToolsWindow):
    tree = TreeWindow.TreeWindow()
    a0.set_display_area(tree)


def address_window(a0: ToolsWindow):
    addressWindow = AdressWindow.MainWindow()
    a0.set_display_area(addressWindow)


def web_window(a0: ToolsWindow):
    webWindow = WebWindow('https://qfluentwidgets.com/zh/pages/pro/')
    a0.set_display_area(webWindow)


if __name__ == '__main__':
    app = QApplication(sys.argv)

    window = ToolsWindow.ToolsWindow()
    window.show()

    # button 可以再抽象一层，将信号连接进行封装
    treeButton = PushButton('树状列表展示')
    window.add_menu_item(treeButton)
    treeButton.clicked.connect(lambda: tree_window(window))

    fileButton = PushButton('文件管理')
    window.add_menu_item(fileButton)
    fileButton.clicked.connect(lambda: address_window(window))

    browButton = PushButton('资料页')
    window.add_menu_item(browButton)
    browButton.clicked.connect(lambda: web_window(window))

    sys.exit(app.exec())
